import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import store from '@/store'
import TypeNav from '@/components/TypeNav'
import Carousel from '@/components/Carousel'
import Pagination from '@/components/Pagination'
import 'element-ui/lib/theme-chalk/index.css'
import '@/mock/mockServer' //需要引入这个js文件 目的是为了让这个mock文件执行
import * as api from '@/api'
import { Button, MessageBox } from 'element-ui'
import VueLazyload from 'vue-lazyload'
import dog from '@/assets/dog.jpeg'
import '@/utils/validate'

Vue.use(VueLazyload, {
  loading: dog,
})
Vue.config.productionTip = false

Vue.prototype.$msgbox = MessageBox
Vue.prototype.$alert = MessageBox.alert

Vue.component(Button.name, Button)
Vue.component('TypeNav', TypeNav)
Vue.component('Pagination', Pagination)
Vue.component('Carousel', Carousel)
new Vue({
  // 在初始化之前安装全局事件总线
  beforeCreate() {
    Vue.prototype.$bus = this
    Vue.prototype.$api = api
  },
  store,
  router,
  render: (h) => h(App),
}).$mount('#app')
